package cn.base.zuoye1;

public class Code008 {
    public static void main(String[] args) {
        int[] arr = {25, 12, 12, 36};
        // int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            int max = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[j] > arr[max]) {
                    max = j;//遍历数组，找出最大值的索引
                }
            }
            if (i != max) {
                int temp = arr[i];
                arr[i] = arr[max];
                arr[max] = temp;
            }
            System.out.print(arr[i] + " ");
        }
    }
}
